﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Sympol;
using Sympol.Interface.Token;


namespace Sympol
{
    

    public enum UnaryOperator
    {
        Not,
        Inc,
        Dec,
        Return
    }

    public enum ValueType
    {
        Obj,
        Fun,
        Bln,
        Str,
        Int,
        Dbl,
        Undef
    }
   

    public interface ICompiler
    {
        IStartable Compile(IEnumerable<IToken> tokens);
    }

    public interface IStartable
    {
        void Start(string[] args);
    }

    public interface IProgram : IStartable
    {

    }

    public interface IValue : IExpression
    {
        string AsString();
        ValueType Type { get; set; }
    }

    public interface IUndefinedValue : IValue, IScope
    {

    }

    public interface IBooleanValue : IValue, IScope
    {
        bool TypedValue { get; set; }
    }

    public interface IIntegerValue : IValue, IScope
    {
        int TypedValue { get; set; }
    }

    public interface IDoubleValue : IValue, IScope
    {
        Double TypedValue { get; set; }
    }

    public interface IStringValue : IValue, IScope
    {
        String TypedValue { get; set; }
    }

    public interface IDateTimeValue : IValue, IScope
    {
        DateTime TypedValue { get; set; }
    }

    public interface IFunctionValue : IValue, IScope, IStartable
    {
        IEnumerable<IParameter> Parameters { get; set; }
        IEnumerable<IExpression> Statments { get; set; }
    }

    public interface IScope
    {
        IScope LexicalHost { get; set; }
        IEnumerable<IVariable> Variables { get; set; }
        IValue GetValue(string name);
    }

    public interface IObject : IValue, IScope
    {
        IEnumerable<IScope> ProtoTypes { get; set; }
    }

    public interface INameSpace : IScope
    {
        string Name { get; set; }
        IEnumerable<INameSpace> ChildSpaces { get; set; }
        void Add(INameSpace createNameSpace);
    }

    public interface IParameter
    {
        string Name { get; set; }
    }

    public interface IExpression
    {
        IValue Evaluate();
    }

    public interface IVariable : IExpression
    {
        IScope Host { get; }
        string Name { get; set; }
        IValue Value { get; set; }
        void Assign(IValue value);
    }

    public interface ICall : IVariable, IValue
    {
        IEnumerable<IExpression> Parameters { get; set; }
    }
    
    public interface IReturn : IExpression
    {
        IExpression Operand { get; set; }
    }

    public interface IAssignment : IExpression
    {
        IExpression LeftOperand { get; set; }
        IExpression RightOperand { get; set; }
    }


    public interface ILocation
    {
        string File { get; set; }
        int Line { get; set; }
        int Char { get; set; }
    }

    public interface ICodeLocation
    {
        IValue Host { get; set; }
        IExpression Expression { get; set; }
    }

}
        


